using System;
using System.Collections.Generic;
using ZoneFiveSoftware.Common.Visuals.Fitness;
using ZoneFiveSoftware.Common.Data;
using ZoneFiveSoftware.Common.Data.Fitness;
using ZoneFiveSoftware.Common.Data.GPS;
using System.Text;
using System.Web;
using System.Xml;


namespace BENBUN.Actions
{
    public class RegisterActivity
    {
        String username;
        String password;
        public ITimeValueEntry<IGPSPoint> startpoint;

        String URLBase = " http://wiw/api.php";
        String URLString;
        String URLParms;

        public RegisterActivity()
        {
            this.username = Settings.Settings.ForumUsername;
            this.password = Settings.Settings.ForumPassword;
        }

        public void poke()
        {
            
            this.URLParms = "u=" + this.username;
            this.URLParms = this.URLParms + "&";
            this.URLParms = this.URLParms + "p=" + this.password;
            this.URLParms = this.URLParms + "&";
            this.URLParms = this.URLParms + "lat=" + this.startpoint.Value.LatitudeDegrees;
            this.URLParms = this.URLParms + "&";
            this.URLParms = this.URLParms + "lon=" + this.startpoint.Value.LongitudeDegrees;

            this.URLString = this.URLBase + "?" + this.URLParms;
            String TestString = "This is a <Test String>.";
            StringWriter writer = new StringWriter();
            Server.HtmlEncode(TestString, writer);
            String EncodedString = writer.ToString();

            XmlTextReader reader = new XmlTextReader(URLString);

            if ((this.username != "") & (this.password != ""))
            {


                try
                {
                    while (reader.Read())
                    {
                        // Do some work here on the data.
                        Console.WriteLine(reader.Name);
                    }
                }
                catch (Exception)
                {
                    reader.Close();

                }
                Console.ReadLine();
            }
        }


    }
}
